package com.yida.gwj.expend.outside.enums;

import cn.hutool.core.util.ObjectUtil;

/**
 * 业务类型枚举
 *
 * @author liangp
 * @date 2023/02/24
 */
public enum BusinessTypeEnum {
    /**
     * 业务状态  1:预受理 2:正式受理
     */
    PREPARE(1, "资金申请预受理"),
    FORMAL(2, "资金申请正式受理"),
    OLD_SYSTEM(3, "旧系统"),
    APPROPRIATE_PREPARE(4, "拨付预受理"),
    APPROPRIATE_FORMAL(5, "拨付正式受理"),
    URGENT_PREPARE(6, "应急资金申请预受理"),
    URGENT_FORMAL(7,"应急资金申请正式受理"),
    URGENT_APPROPRIATE_PREPARE(8,"应急资金拨付预受理"),
    URGENT_APPROPRIATE_FORMAL(9,"应急资金拨付正式受理"),
    ;

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    BusinessTypeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 状态码
     */
    private final Integer code;

    /**
     * 描述
     */
    private final String msg;


    public static BusinessTypeEnum translate(Integer code) {
        for (BusinessTypeEnum value : BusinessTypeEnum.values()) {
            if (ObjectUtil.equals(value.getCode(), code)) {
                return value;
            }
        }
        return null;
    }
}
